<?php
/**
 * Created by PhpStorm.
 * User: Machenike
 * Date: 2019/9/16
 * Time: 16:57
 */

namespace App\Project;

use App\Base\BaseCache;
use App\Base\BaseModel;
use App\Model\ArtCategoryModel;
use App\Model\ArtModel;

const __ART_CAT_GWY__        = 18;
const __ART_CAT_GJGWY__      = 19;
const __ART_CAT_SYDW__       = 20;
const __ART_CAT_XDS__        = 21;
const __ART_CAT_SZYF__       = 22;
const __ART_CAT_LXGG__       = 23;



class ZhengHuaModel extends BaseModel
{

    private $cacheOn = 1;
    private $artModel;
    public function __construct($thisGetDoctrine)
    {
        parent::__construct($thisGetDoctrine);
        $this->artModel = new ArtModel($this->getDoctrine());
    }

    public function getCommonData()
    {
        //导航
        //banner
        //广告位
        //页面底部
    }


    public function getIndexData($categoryId,$page = 0,$limit = 10,$province=0,$isHot=0)
    {
        //资讯栏目
        $bc = new BaseCache();
        $cache = $bc->getItem("art_list_$categoryId"."_"."$page"."_"."$limit");
//        if ($cache) {return $cache;}
        $data = $this->artModel->getIndexList($categoryId,$page,$limit,$province,$isHot);
        $bc->setItem("art_list_$categoryId"."_"."$page"."_"."$limit",$data);
        return $data;
    }


    public function updateAllCache()
    {
        //首页资讯列表数据
        $this->getIndexData(__ART_CAT_GWY__);
    }

}